module Perishable
  extend ActiveSupport::Concern


  def self.all_stale
    (@@last_seens ||= {}).keys.select { | key | self.last_seens[key].is_stale }
  end

  def touch ;    (@@last_seens ||= {})[self.id]                        = Time.now ; end ;

  def is_stale ; (@@last_seens ||= {})[self.id] + CLIENT_STALE_TIMEOUT < Time.now ; end ;
end
